import Vue from 'vue'
import Cookies from 'js-cookie'
import 'normalize.css/normalize.css' // a modern alternative to CSS resets
import Element from 'element-ui'
import './styles/element-variables.scss'
// import enLang from 'element-ui/lib/locale/lang/en'
import '@/styles/index.scss' // global css
import App from './App'
import store from './store'
import router from './router'
import './icons' // icon
import './permission' // permission control
import './utils/error-log' // error log
import * as filters from './filters' // global filters
import microApp from '@micro-zoe/micro-app'
import { EventCenterForMicroApp } from '@micro-zoe/micro-app'
import __ from './components/index'
import X2Dialog from './plugins/x2dialog/index'
import PUBLIC from '@/utils/public'

// if (process.env.NODE_ENV === 'production') {
//   const { mockXHR } = require('../mock')
//   mockXHR()
// }

microApp.start()
window.EbusForDesigner = new EventCenterForMicroApp('ali-designer')
window.EbusForPreview = new EventCenterForMicroApp('ali-preview')
window.EbusForRun = new EventCenterForMicroApp('ali-run')
Vue.use(Element, { size: Cookies.get('size') || 'mini' })
Vue.use(X2Dialog)
Vue.use(PUBLIC)
Object.keys(filters).forEach((key) => {
  Vue.filter(key, filters[key])
})
Vue.config.productionTip = false
new Vue({
  el: '#app',
  router,
  store,
  render: (h) => h(App),
})
